package listener.sessionlistener.bindlisten;

import javax.servlet.http.HttpSessionBindingEvent;
import javax.servlet.http.HttpSessionBindingListener;

/**
 * @description 当User对象被setAttribute到Session或从中remove, 则会触发
 *
 * @author linshuo
 *
 */
public class User implements HttpSessionBindingListener {
    @Override
    // set到Session时触发
    public void valueBound(HttpSessionBindingEvent event) {
        System.out.println("User对象被set到session的Attribute了");
    }

    @Override
    // 从Session中remove时触发
    public void valueUnbound(HttpSessionBindingEvent event) {
        System.out.println("User对象从session的Attribute中remove掉了");
    }

    private String name;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}
